/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Notepad;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author HP 6200 Pro
 */
public class DocFile extends Thread {

    private final String duongDan;
    private String noiDung;

    public String getNoiDung() {
        return noiDung;
    }

    public DocFile(String duongDan) {
        this.duongDan = duongDan;
    }

    @Override
    public void run() {
        noiDung = null;
        try {
            try (FileReader file = new FileReader(duongDan)) {
                BufferedReader dataFile = new BufferedReader(file);

                String dongHienTai = null;
                while ((dongHienTai = dataFile.readLine()) != null) {
                    // Nối thêm ký tự ngắt từng dòng
                    noiDung += dongHienTai + "\n";
                }

            }
        } catch (IOException e) {
            // Khi ko doc duoc file muon xuat j ra thi e viet vào day
            e.printStackTrace();
        }
    }
}
